﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000095 RID: 149
	public class TCreateProcedureStmt : TRoutine
	{
		// Token: 0x06000438 RID: 1080 RVA: 0x002FAE65 File Offset: 0x002F9065
		public TConstant getProcedureLanguage()
		{
			return this.procedureLanguage;
		}

		// Token: 0x06000439 RID: 1081 RVA: 0x002FAE6D File Offset: 0x002F906D
		public TObjectName getOuterLabelName()
		{
			return this.outerLabelName;
		}

		// Token: 0x0600043A RID: 1082 RVA: 0x002FAE75 File Offset: 0x002F9075
		public TConstant getLinkSymbol()
		{
			return this.linkSymbol;
		}

		// Token: 0x0600043B RID: 1083 RVA: 0x002FAE7D File Offset: 0x002F907D
		public TConstant getObjfile()
		{
			return this.objfile;
		}

		// Token: 0x0600043C RID: 1084 RVA: 0x002FAE85 File Offset: 0x002F9085
		public TCreateProcedureStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstcreateprocedure;
		}

		// Token: 0x0600043D RID: 1085 RVA: 0x002FAE99 File Offset: 0x002F9099
		private new void buildsql()
		{
		}

		// Token: 0x0600043E RID: 1086 RVA: 0x002FAE9B File Offset: 0x002F909B
		private new void clear()
		{
		}

		// Token: 0x0600043F RID: 1087 RVA: 0x002FAE9D File Offset: 0x002F909D
		private new string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000440 RID: 1088 RVA: 0x002FAEA4 File Offset: 0x002F90A4
		private void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x06000441 RID: 1089 RVA: 0x002FAEA6 File Offset: 0x002F90A6
		public TObjectName getEndlabelName()
		{
			return this.endlabelName;
		}

		// Token: 0x06000442 RID: 1090 RVA: 0x002FAEAE File Offset: 0x002F90AE
		public TObjectName getStoredProcedureName()
		{
			return this.procedureName;
		}

		// Token: 0x06000443 RID: 1091 RVA: 0x002FAEB6 File Offset: 0x002F90B6
		public TObjectName getProcedureName()
		{
			return this.procedureName;
		}

		// Token: 0x06000444 RID: 1092 RVA: 0x002FAEC0 File Offset: 0x002F90C0
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TCreateProcedureSqlNode tcreateProcedureSqlNode = (TCreateProcedureSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.procedureName = tcreateProcedureSqlNode.ProcedureName;
			base.setRoutineName(this.procedureName);
			this.procedureLanguage = tcreateProcedureSqlNode.ProcedureLanguage;
			if (this.procedureLanguage != null)
			{
				base.setRoutineLanguageInConstant(this.procedureLanguage);
				base.setRoutineLanguage(this.procedureLanguage.ToString());
			}
			this.outerLabelName = tcreateProcedureSqlNode.LabelName;
			this.objfile = tcreateProcedureSqlNode.Objfile;
			this.linkSymbol = tcreateProcedureSqlNode.LinkSymbol;
			base.setReturnDataType(tcreateProcedureSqlNode.ReturnDataType);
			if (tcreateProcedureSqlNode.FunctionBody != null)
			{
				base.setRoutineBodyInConstant(tcreateProcedureSqlNode.FunctionBody);
				base.setRoutineBody(tcreateProcedureSqlNode.FunctionBody.ToString());
			}
			this.ParameterDeclarations = tcreateProcedureSqlNode.Parameters;
			if (this.ParameterDeclarations != null)
			{
				for (int i = 0; i < this.ParameterDeclarations.size(); i++)
				{
					this.TopStatement.SymbolTable.Push(new TSymbolTableItem(9, this, this.ParameterDeclarations.getParameterDeclarationItem(i)));
					TObjectName parameterName = this.ParameterDeclarations.getParameterDeclarationItem(i).ParameterName;
				}
			}
			if (tcreateProcedureSqlNode.DeclareStmts != null)
			{
				tcreateProcedureSqlNode.DeclareStmts.doParse(this, ESqlClause.unknown);
				for (int j = 0; j < tcreateProcedureSqlNode.DeclareStmts.size(); j++)
				{
					this.TopStatement.SymbolTable.Push(new TSymbolTableItem(10, this, tcreateProcedureSqlNode.DeclareStmts.getStatementSqlNode(j).Stmt));
					this.DeclareStatements.add(tcreateProcedureSqlNode.DeclareStmts.getStatementSqlNode(j).Stmt);
				}
			}
			if (tcreateProcedureSqlNode.Stmt != null)
			{
				tcreateProcedureSqlNode.Stmt.doParse(this, ESqlClause.unknown);
				this.BodyStatements.add(tcreateProcedureSqlNode.Stmt.Stmt);
			}
			else if (tcreateProcedureSqlNode.Blcok != null)
			{
				tcreateProcedureSqlNode.Blcok.Stmts.doParse(this, ESqlClause.unknown);
				for (int k = 0; k < tcreateProcedureSqlNode.Blcok.Stmts.size(); k++)
				{
					this.BodyStatements.add(tcreateProcedureSqlNode.Blcok.Stmts.getStatementSqlNode(k).Stmt);
				}
			}
			if (tcreateProcedureSqlNode.ExceptionClause != null)
			{
				tcreateProcedureSqlNode.ExceptionClause.doParse(this, ESqlClause.unknown);
				this.ExceptionClause = tcreateProcedureSqlNode.ExceptionClause;
			}
			if (tcreateProcedureSqlNode.DeclareStmts != null)
			{
				for (int l = 0; l < tcreateProcedureSqlNode.DeclareStmts.size(); l++)
				{
					this.TopStatement.SymbolTable.Pop();
				}
			}
			if (this.ParameterDeclarations != null)
			{
				for (int m = 0; m < this.ParameterDeclarations.size(); m++)
				{
					this.TopStatement.SymbolTable.Pop();
				}
			}
			this.endlabelName = tcreateProcedureSqlNode.EndLabelName;
			return 0;
		}

		// Token: 0x06000445 RID: 1093 RVA: 0x002FB170 File Offset: 0x002F9370
		private void doParseFunctionBody(string inputSQL, bool isSQLBlock)
		{
		}

		// Token: 0x06000446 RID: 1094 RVA: 0x002FB172 File Offset: 0x002F9372
		private void postgresqlProcedureDefinition(TCustomSqlStatement psql, TCreateProcedureSqlNode createProcedureNode)
		{
		}

		// Token: 0x06000447 RID: 1095 RVA: 0x002FB174 File Offset: 0x002F9374
		public void setOuterLabelName(TObjectName outerLabelName)
		{
			this.outerLabelName = outerLabelName;
		}

		// Token: 0x06000448 RID: 1096 RVA: 0x002FB17D File Offset: 0x002F937D
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000449 RID: 1097 RVA: 0x002FB18D File Offset: 0x002F938D
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.ParameterDeclarations != null)
			{
				this.ParameterDeclarations.acceptChildren(v);
			}
			this.BodyStatements.acceptChildren(v);
			v.postVisit(this);
		}

		// Token: 0x0600044A RID: 1098 RVA: 0x002FB1BD File Offset: 0x002F93BD
		public void setProcedureName(TObjectName procedureName)
		{
			this.procedureName = procedureName;
		}

		// Token: 0x040010E6 RID: 4326
		private TObjectName outerLabelName;

		// Token: 0x040010E7 RID: 4327
		private TObjectName functionName;

		// Token: 0x040010E8 RID: 4328
		private TConstant objfile;

		// Token: 0x040010E9 RID: 4329
		private TConstant linkSymbol;

		// Token: 0x040010EA RID: 4330
		private TConstant procedureLanguage;

		// Token: 0x040010EB RID: 4331
		private TObjectName endlabelName;

		// Token: 0x040010EC RID: 4332
		private TObjectName procedureName;
	}
}
